// 用于定义管理员数据所对应的schema和model
// 引入mongoose
const mongoose = require('mongoose')

// 创建schema对象

const schema = new mongoose.Schema({
  username: {
    type: String,
    required: true,
    unique: true,
  },
  password: {
    type: String,
    required: true,
  },

  last_login: {
    type: Date,
    default: Date.now(),
  },
  registe_date: {
    type: Date,
    default: Date.now(),
  },
})

// 创建model
const model = mongoose.model('admin', schema)

module.exports = model
